DataProvider

Kind of class:class
Inherits from:Array
Classpath:gfx.data.DataProvider
File last modified:Tuesday, 29 June 2010, 09:03:27
An Array-based DataProvider. The DataProvider can be extended, or existing Arrays can be made into a DataProvider using the static DataProvider.initialize. DataProvider.initialize() adds the required interface for data components in the Scaleform component framework, including a model for handling asynchronous responses, although that is not necessary in this particular implementation.

Summary


Constructor
Instance properties
Class methods
  • initialize
    • Mix-in the DataProvider functionality to an Array.
Instance methods
  • indexOf
    • Get the index of an item in the DataProvider.
  • requestItemAt
    • Request an item at a specified index.
  • requestItemRange
    • Get a range of items between two specified indexes inclusive of the items at beginIndex and endIndex.
  • invalidate
    • The data or length of the DataProvider has changed.
  • cleanUp
    • Clean up callBacks and other data references in the DataProvider.

Constructor

DataProvider

function DataProvider (
total:Number)

Create a new DataProvider. Typically, instead of instantiating a DataProvider, an Array can simply be passed into a component that uses a DataProvider, and it will be converted using the DataProvider.initialize() static method. The DataProvider can be used in place of an Array though. Note that you can not pass arguments to the DataProvider constructor.

Instance properties

addEventListener

addEventListener:Function
(read,write)

Mixed in from EventDispatcher

hasEventListener

hasEventListener:Function
(read,write)

Mixed in from EventDispatcher

isDataProvider

isDataProvider:Boolean = true
(read,write)

Determine if an Object is a DataProvider, either by extension, or using DataProvider.initialize.()

removeAllEventListeners

removeAllEventListeners:Function
(read,write)

Mixed in from EventDispatcher

removeEventListener

removeEventListener:Function
(read,write)

Mixed in from EventDispatcher

Class methods

initialize

static function initialize (
data:Object)

Mix-in the DataProvider functionality to an Array.

Instance methods

cleanUp

function cleanUp (
) : Void

Clean up callBacks and other data references in the DataProvider. No clean up is required in this simple implmentation beyond cleaning up event queues.

indexOf

function indexOf (
value:Object, scope:Object, callBack:String) : Number

Get the index of an item in the DataProvider.
Parameters:
value:
The item in the DataProvider.
Returns:
  • The index of the item in the DataProvider, or -1 if not found.

invalidate

function invalidate (
length:Number) : Void

The data or length of the DataProvider has changed. This method dispatches a change event, which notifies the component(s) displaying the data that they may need to update. This method expects a length parameter to be passed in when using an asynchronous approach where only requested data is loaded into the DataProvider.
Parameters:
length:
The current length of the data set, which needs to be kept up to date.

requestItemAt

function requestItemAt (
index:Number, scope:Object, callBack:String) : Object

Request an item at a specified index. Items will be passed back into the requesting object using a callBack.
Parameters:
index :
The index of the requested item in the DataProvider.
scope :
The scope of the requesting object.
callBack:
The function name of the callBack.
Returns:
  • The requested item, if it is immediately available. Note that components will not use the return value.

requestItemRange

function requestItemRange (
startIndex:Number, endIndex:Number, scope:Object, callBack:String) : Array

Get a range of items between two specified indexes inclusive of the items at beginIndex and endIndex.
Parameters:
startIndex:
The start index of the range of requested items in the DataProvider.
endIndex :
The end index of the range of requested items in the DataProvider.
scope :
The scope of the requesting object.
callBack :
The function name of the callBack.
Returns:
  • The items in the range, if they are immediately available. Note that components will not use the return value.